﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using CNShapes;

namespace CNNetworking
{
    /// <summary>
    /// The interface used by the client to send data to the server. This includes
    /// initial connection and sending updates to data that has been changed by the
    /// client. The server 'broadcasts' data sent by other clients back to the clients
    /// via the IServerToClient callback-interface.
    /// </summary>
    [ServiceContract(CallbackContract=typeof(IServerToClient))]
    interface IClientToServer
    {
        /// <summary>
        /// Called after we have made the physical connection to the server, and passed our
        /// name to the server.
        /// </summary>
        [OperationContract(IsOneWay = true)]
        void connect(Guid clientID, string strName);

        /// <summary>
        /// Called by the client shortly before disconnecting.
        /// </summary>
        [OperationContract(IsOneWay = true)]
        void disconnect(Guid clientID);

        /// <summary>
        /// Sends the client's address book to the server.
        /// </summary>
        [OperationContract(IsOneWay = true)]
        void sendAddressBook(IList<ConnectionSettings> addressBook);

        /// <summary>
        /// Sends a shape update to the server.
        /// </summary>
        [OperationContract(IsOneWay = true)]
        void shapeEdited(Guid clientID, Guid sessionID, Guid pageID, byte[] shapeData);

		/// <summary>
		/// Tells the server that a shape has been removed from a page.
		/// </summary>
		[OperationContract(IsOneWay = true)]
		void shapeRemoved(Guid clientID, Guid sessionID, Guid pageID, Guid shapeID);

		/// <summary>
		/// Tells the server that a new session has been opened.
		/// </summary>
		[OperationContract(IsOneWay = true)]
		void newSession(Guid clientID, Guid sessionID);

		/// <summary>
		/// Tells the server that a new page has been opened.
		/// </summary>
		[OperationContract(IsOneWay = true)]
		void newPage(Guid clientID, Guid sessionID, Guid pageID);

		/// <summary>
		/// Tells the server that the active page has been changed.
		/// </summary>
		[OperationContract(IsOneWay = true)]
		void activePageChanged(Guid clientID, Guid sessionID, Guid pageID);

	}
}
